package com.hd.trans.ui.model;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.hd.trans.db.bean.HuDunLanguage;

public class LanguageModel extends ViewModel {
    private MutableLiveData<HuDunLanguage> mLanguageFrom = new MutableLiveData<>();
    private MutableLiveData<HuDunLanguage> mLanguageTo = new MutableLiveData<>();

    public MutableLiveData<HuDunLanguage> getLanguageFrom() {
        return mLanguageFrom;
    }

    public void setLanguageFrom(HuDunLanguage item) {
        mLanguageFrom.setValue(item);
    }

    public MutableLiveData<HuDunLanguage> getLanguageTo() {
        return mLanguageTo;
    }

    public void setLanguageTo(HuDunLanguage item) {
        mLanguageTo.setValue(item);
    }

    public String getLanguageFromCode(){
        if (mLanguageFrom.getValue() == null) {
            return "";
        }
        return mLanguageFrom.getValue().getTranslateCode();
    }

    public String getLanguageToCode(){
        if (mLanguageTo.getValue() == null) {
            return "";
        }
        return mLanguageTo.getValue().getTranslateCode();
    }
}
